package v1

import (
	"base-web/api/reponse"
	"base-web/util"
	"github.com/gin-gonic/gin"
)

// @Tags 文件上传
// @Summary 上传用户文件
// @Description 通用文件上传
// @Accept mpfd
// @Produce  json
// @Param file formData file true "文件"
// @Success 200 {string} string "{ "code": 0, "data": { "url": "http://localhost:8080/static/upload/2020514/1589426008.jpg" }, "msg": "操作成功" }"
// @Router /api/v1/user/upload [post]
func Upload(c *gin.Context) {
	upload, err := util.GinUpload(c, "file")
	if err != nil {
		reponse.FailWithMessage(err.Error(), c)
		return
	}
	reponse.OKWithDta(upload, c)
}
